package cn.tianjindong.blog_manager.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.tianjindong.blog.common.pojo.PageView;
import cn.tianjindong.blog.pojo.BlogManagerVisitlog;
import cn.tianjindong.blog_manager.service.VisitLogService;

@Controller
public class VisitLogController {

	@Autowired
	private VisitLogService visitLogService;

	/**
	 * 前往管理员登录日志界面
	 * 
	 * @param model
	 * @param currentPage
	 *            当前所在页
	 * @param countItem
	 *            每页显示条数
	 * @return
	 */
	@RequestMapping("/manager-loginlog.html")
	public String toManagerVisitLogPage(Model model, @RequestParam(defaultValue = "1") Integer currentPage,
			@RequestParam(defaultValue = "8") Integer countItem) {
		PageView<BlogManagerVisitlog> pageView = visitLogService.getManagerVisitLogPageView(currentPage, countItem);
		model.addAttribute("pageView", pageView);
		return "/manager-loginlog";
	}
}
